﻿<%@ Page Language="C#" ValidateRequest="false" AutoEventWireup="true" CodeBehind="AdventureWork.aspx.cs" Inherits="Simple.RadGridSortAndPaging.Views.AdventureWork" EnableViewState="false" ViewStateMode="Disabled" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <title></title>
</head>
<body>
    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>

        <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
        <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
        <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel" LoadingPanelID="RadAjaxLoadingPanel1">
        </telerik:RadAjaxPanel>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <%--    <ClientEvents OnRequestStart="onRequestStart" />
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>--%>
        </telerik:RadAjaxManager>
        <telerik:RadFormDecorator runat="server" DecorationZoneID="demo" EnableRoundedCorners="false" DecoratedControls="All" />
        <asp:ValidationSummary runat="server" ID="ValidationSummary1" />
        <div>
            <div>
                <telerik:RadGrid ID="RadGrid1" runat="server"
                    AllowPaging="True"
                    AllowSorting="True"
                    AllowCustomPaging="True"
                    AllowAutomaticDeletes="False"
                    AllowAutomaticInserts="False"
                    AllowAutomaticUpdates="False"
                    Culture="zh-TW" Width="100%"
                    GroupPanelPosition="Top"
                    GroupingEnabled="False"
                    EnableHeaderContextMenu="True"
                    AutoGenerateDeleteColumn="False"
                    AutoGenerateEditColumn="False"
                    OnNeedDataSource="RadGrid1_NeedDataSource"
                    GridLines="None"
                    ItemType="Simple.RadGridSortAndPaging.Models.Orders">
                    <HeaderContextMenu EnableTheming="True">
                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                    </HeaderContextMenu>
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                    <GroupingSettings CaseSensitive="False" />
                    <FilterMenu EnableTheming="False">
                        <CollapseAnimation Type="OutSine" Duration="200"></CollapseAnimation>
                    </FilterMenu>
                    <ExportSettings ExportOnlyData="True" OpenInNewWindow="True">
                        <Excel Format="ExcelML"></Excel>
                    </ExportSettings>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True"></Selecting>
                    </ClientSettings>

                    <MasterTableView
                        CommandItemDisplay="TopAndBottom"
                        AllowSorting="True"
                        EditMode="PopUp"
                        AllowFilteringByColumn="True"
                        DataKeyNames="OrderID"
                        ItemType="Simple.RadGridSortAndPaging.Models.Orders"
                        AutoGenerateColumns="False">
                        <CommandItemSettings ShowExportToExcelButton="True" AddNewRecordText="新增" ShowAddNewRecordButton="true"></CommandItemSettings>
                        <EditFormSettings>
                            <EditColumn UniqueName="EditCommandColumn1" ButtonType="ImageButton" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                        </EditFormSettings>
                        <NoRecordsTemplate>
                            找不到資料！！
                        </NoRecordsTemplate>

                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>

                        <Columns>
                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" Text="Edit" HeaderText="" UniqueName="Edit">
                            </telerik:GridButtonColumn>
                            <telerik:GridTemplateColumn HeaderText="OrderID" UniqueName="OrderID"
                                DataField="OrderID" SortExpression="OrderID">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text="<%# BindItem.OrderID %>"></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text="<%# BindItem.OrderID %>"></asp:Label>
                                </EditItemTemplate>
                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn DataField="CustomerID" AutoPostBackOnFilter="True" FilterControlAltText="Filter CustomerID column" HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID11" SortExpression="CustomerID" UniqueName="CustomerID11"
                                CurrentFilterFunction="Contains" AutoPostBackOnFilter="True" ShowFilterIcon="true" FilterDelay="2600" FilterControlAltText="Filter CustomerID column">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                                <HeaderStyle HorizontalAlign="Center" Width="70px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EmployeeID" FilterControlAltText="Filter EmployeeID column" HeaderText="EmployeeID" SortExpression="EmployeeID" UniqueName="EmployeeID">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="OrderDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter FirstName column" HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="RequiredDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter RequiredDate column" HeaderText="MiddleName" SortExpression="RequiredDate" UniqueName="RequiredDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShippedDate" DataFormatString="{0:yyyy/MM/dd}" FilterControlAltText="Filter LastName column" HeaderText="ShippedDate" SortExpression="ShippedDate" UniqueName="ShippedDate">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipVia" FilterControlAltText="Filter ShipVia column" HeaderText="ShipVia" SortExpression="ShipVia" UniqueName="ShipVia">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Freight" FilterControlAltText="Filter Freight column" HeaderText="Freight" SortExpression="Freight" UniqueName="Freight">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipName" FilterControlAltText="Filter ShipName column" HeaderText="ShipName" SortExpression="AdditionalContactInfo" UniqueName="ShipName">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipAddress" FilterControlAltText="Filter ShipAddress column" HeaderText="ShipAddress" SortExpression="ShipAddress" UniqueName="ShipAddress">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipCity" FilterControlAltText="Filter ShipCity column" HeaderText="ShipCity" SortExpression="ShipCity" UniqueName="ShipCity">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipRegion" FilterControlAltText="Filter ShipRegion column" HeaderText="ShipRegion" SortExpression="ShipRegion" UniqueName="ShipRegion">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ShipCountry" FilterControlAltText="Filter ShipCountry column" HeaderText="ShipCountry" SortExpression="ShipCountry" UniqueName="ShipCountry">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text=""></ModelErrorMessage>
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>

                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete" HeaderText="" UniqueName="Delete" />
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>
        </div>
        <br />
    </form>
</body>
</html>